import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { StatisticsPanelInterface, Response } from '../model';
import { SITE_SUMMARY } from './baseUrlConfig';

@Injectable({
  providedIn: 'root'
})
export class SiteSummaryService {

  constructor(
    private httpClient: HttpClient,
  ) { }

  /**
   * 获取统计面板数据
   */
  getStatisticsPanelData(): Promise<StatisticsPanelInterface[]> {
    return new Promise<StatisticsPanelInterface[]>((resolve, reject) => {
      this.httpClient.get<Response<StatisticsPanelInterface[]>>(SITE_SUMMARY.GET_STATISTICS_DATA).subscribe(response => {
        resolve(response.data)
      })
    })
  }

  getPowerTrend(): Promise<any> {
    return new Promise((resolve) => {

    })
  }
}
